<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="wd">
        <input type="button" value="百度一下，你就知道" @click="searchMsg()">
        <ul>
            <li v-for="(value,index) in arr" :key="index">{{value}}</li>
        </ul>
    </div>
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            wd:"蔡徐坤",
            arr:[]
        },
        methods:{
            searchMsg(){
                $.ajax({
                    url:"https://www.baidu.com/su",
                    data:{
                        wd:this.wd
                    },
                    dataType:"jsonp",
                    jsonp:"cb",
                    success:({s})=>{
                        this.arr=s;
                    }
                });
            }
        },
        watch:{
            wd:{
                handler(){
                    this.searchMsg();
                },
                immediate:true
            }
        }
    })
</script>
</html>